package com.huike.business.service.impl;

import com.huike.business.domain.TbBusiness;
import com.huike.business.domain.TbBusinessTrackRecord;
import com.huike.business.mapper.TbBusinessMapper;
import com.huike.business.mapper.TbBusinessRecordMapper;
import com.huike.business.service.ITbBusinessRecordService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @Author: dw
 * @Date 2022/3/31 22:35
 */

@Service
public class TbBusinessRecordServiceImpl implements ITbBusinessRecordService {

    @Autowired(required = false)
    private TbBusinessRecordMapper tbBusinessRecordMapper;

    @Autowired(required = false)
    private TbBusinessMapper tbBusinessMapper;

    /**
     * 商机跟进记录
     *
     * @param businessId
     * @return
     */
    @Override
    public List<TbBusinessTrackRecord> selectTbBusinessRecordList(Long businessId) {

        return tbBusinessRecordMapper.selectTbBusinessTrackRecordList(businessId);
    }

    /**
     * 添加商机跟进记录
     *
     * @param tbBusiness            商机表实体类
     * @param tbBusinessTrackRecord 商机
     * @return
     */
    @Override
    public Integer addTbBusinessRecord(TbBusiness tbBusiness, TbBusinessTrackRecord tbBusinessTrackRecord) {
        //修改数据
        tbBusinessMapper.updateTbBusiness(tbBusiness);

        return tbBusinessRecordMapper.addBusinessRecord(tbBusinessTrackRecord);
    }
}
